﻿/// <reference path="../../Scripts/jquery-1.6.1.js" />
Sys.Application.add_load(ApplicationLoadHandler)
function ApplicationLoadHandler(sender, args) {
    if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
        Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest);
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
    }
}

function InitializeRequest(sender, args) {
    var tab = $("#boxTable");
    var mask = $('<div id="DataLoadingMask" class="dataLoading" style="display: none;"></div>').appendTo(document.body);
    var offset = tab.offset();
    if (tab.length == 1) {
        mask.css("width", tab.outerWidth()).css("height", tab.outerHeight()).css({top:offset.top, left:offset.left}).show();
    }
    var refresh = $(".btnRefresh");
    refresh.css("background-position", "-112px 16px").html("<img src='images/loading.gif' alt='' style='margin-top:0px;' />");
}

function EndRequest(sender, args) {
    var refresh = $(".btnRefresh");
    refresh.css("background-position-y", 0).html("");
    var mask = $("#DataLoadingMask");
    mask.hide().remove();
}

if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

